using System;
using NUnit.Framework;

namespace ComponentTracer.Tests
{
    [TestFixture]
    public class ExceptionTests
    {
        [Test]
        public void Methoden_Aufruf_ohne_Parameter_wird_getraced() {
            var traceOutput = "";
            var service = new Service();

            var tracedService = TracerProxy.Create<IService>(service, s => { traceOutput += s; });
            Assert.Throws<NotImplementedException>(tracedService.ThrowException);

            StringAssert.StartsWith("ComponentTracer.Tests.ExceptionTests+Service.ThrowException()\n  throws exception System.NotImplementedException", traceOutput);
        }

        public interface IService
        {
            void ThrowException();
        }

        internal class Service : IService
        {
            public void ThrowException() {
                throw new NotImplementedException();
            }
        }
    }
}